= error_messages_for("character")
- form_tag({ :controller => "characters", :action => :update, :id => @character.id }, { :method => :put }) do
  %h3 Character information
  %table
    %tr
      %td Name
      %td= text_field("character", "name", { :size => 40 })
    %tr
      %td Status
      %td= select("character", "active", [["Active", true], ["Inactive", false]])
    %tr
      %td Owner
      %td= select("character", "user_id", @users.collect { |u| [u.name, u.id] }, { :include_blank => true, :selected => @character.user_id })
    %tr
      %td
      %td= submit_tag("Update")
%br


%h3 Roles
- form_tag({ :controller => "characters", :action => :add_role, :id => @character.id}) do
  = select("characters_role", "role_id", @roles_not_filled)
  = submit_tag("Add")
%br

- if (@character.roles.length > 0)
  - form_tag({ :controller => "characters", :action => :delete_roles, :id => @character.id }) do
    %table
      %th Role
      %th= submit_tag("Delete")
      - @character.roles.each do |role|
        %tr
          %td= role.name
          %td= check_box_tag("deleterole#{role.id}")
  %br

- if @character.active?
  %h3 DKP
  %table
    %tr
      %td Shares
      %td= @character.number_of_shares
    %tr
      %td DKP earned
      %td= number_with_precision(@character.dkp_earned)
    %tr
      %td DKP spent
      %td= number_with_precision(@character.dkp_spent)
    %tr
      %td DKP left
      %td= number_with_precision(@character.dkp)
  %br

- if (@character.loot.length > 0)
  %h3 Purchased items
  %table
    - @character.loot.each do |loot|
      %tr
        %td= link_to(loot.item.name, :controller => "items", :action => :edit, :id => loot.item.id)
        %td= loot.price

- if (@character.raids.length > 0)
  %h3 Raids
  %table
    - @character.raids.uniq.each do |r|
      %tr{:class => (r.week.odd? ? "odd" : "even")}
        = render(:partial => r, :locals => { :raid => r })
  %br
